package com.zls.web;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zls.model.ProductModel;
import com.zls.service.ProductService;
import com.zls.util.JsonUtil;
@WebServlet("/insert")
public class ProductInsertServlet extends HttpServlet{

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		ProductService service=new ProductService();
		ProductModel model=JsonUtil.fromJson(req.getInputStream(), ProductModel.class);
		Object result=result=service.insertProductInfo(model);;
		
		resp.setContentType("application/json;charset=UTF-8");
		resp.getWriter().println(result);
	}

}
